<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib  prefix="html" uri="http://struts.apache.org/tags-html-el"%>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Modifica utente</title>
<link href="css/images/favicon.ico" rel="shortcut icon" type="image/x-icon" />
<link rel="stylesheet" type="text/css" href="css/style.css">
<script type="text/javascript">
	function checkForm(){
		var form = document.getElementById('MyForm');
	
		if(form.login.value == '') {
			alert('inserire login');
			return false;
		}
		if(form.password.value == ''){
			alert('inserire la password');
			return false;
		}
		if (form.attivo.value=='') {
			alert('inserisci attivo');
			return false;
		}
		if (form.nome.value=='') {
			alert('inserisci nome');
			return false;
		}
		if (form.cognome.value=='') {
			alert('inserisci cognome');
			return false;
		}
		if (form.email.value=='') {
			alert('inserisci email');
			return false;
		}
		if (form.idGruppo.value=='') {
			alert('inserisci gruppo');
			return false;
		}
		return true;
	}
</script>
</head>
<body>
<jsp:include page="/header.jsp"></jsp:include>

<div id="sidebar">
	<jsp:include page="../menuAdmin.jsp"></jsp:include>
	<ul>		
		<li> <html:link href="PrepareHomeAdminAction.do">Amministrazione</html:link> </li>
		<li> <html:link href="PrepareSearchUtenteFormAction.do">Cerca Utente</html:link> </li>
		<li> <html:link href="PrepareInsertUtenteFormAction.do">Aggiungi Utente</html:link> </li>
	</ul>
</div>
<div id="content">
	${message }
	<html:errors/>
	<h3>Modifica Utente</h3>
	<div class="form_p">
	<html:form styleId="MyForm" action="ConfermaCRUDUtenteModificaAction" method="post">
		<div class="row"><span class="label">Login:</span><span
			class="formw"><html:text property="login"></html:text></span></div>
		<div class="row"><span class="label">Password:</span><span
			class="formw"><html:password property="password"></html:password></span></div>
		<div class="row"><span class="label">Attivo:</span><span
			class="formw"><html:radio property="attivo" value="SI">SI</html:radio>
				<html:radio property="attivo" value="NO">NO</html:radio></span></div>
		<div class="row"><span class="label">Nome:</span><span
			class="formw"><html:text property="nome"></html:text></span></div>
		<div class="row"><span class="label">Cognome:</span><span
			class="formw"><html:text property="cognome"></html:text></span></div>
		<div class="row"><span class="label">Email:</span><span
			class="formw"><html:text property="email"></html:text></span></div>
		<div class="row"><span class="label">Gruppo:</span><span
			class="formw"><html:select property="idGruppo">
					<option value=""> --selezionare-- </option>
					<c:forEach var="gruppo" items="${listaGruppi}">
						<option value="${gruppo.idGruppo}" <c:if test="${gruppo.idGruppo==UtenteForm.idGruppo}">selected="selected"</c:if>>${gruppo}</option>
					</c:forEach>
				</html:select></span></div>
		<html:hidden property="idUtente"/>
		<html:hidden property="codOp" value="modifica"/>
		<div class="row"><html:reset/>
		<html:submit value="Modifica" onclick="return checkForm();"></html:submit></div>
	</html:form>
	</div>
	<html:form action="PrepareListaUtentiAction" method="post">
		<html:submit value="Annulla"></html:submit>
	</html:form>
</div>

<jsp:include page="/footer.jsp"></jsp:include>
</body>
</html>